id_imu=`lsusb | grep "Silicon Labs CP210x UART Bridge" | cut -d' ' -f6`
idVendor=`echo ${id_imu} | cut -d":" -f1`
idProduct=`echo ${id_imu} | cut -d":" -f2`
filename="1-rm_imu.rules"
echo "id_vendor is ${idVendor}"
echo "id_product is ${idProduct}"

sudo mkdir -p /etc/udev/rules.d/
sudo touch /etc/udev/rules.d/${filename}

config="KERNEL==\"ttyUSB*\", ATTRS{idVendor}==\"${idVendor}\", ATTRS{idProduct}==\"${idProduct}\", MODE=\"0777\", SYMLINK+=\"ttyUSBimu\"" 
sudo echo ${config} | sudo tee /etc/udev/rules.d/${filename}
echo "The written rule:"
sudo cat /etc/udev/rules.d/${filename}

echo "all the rules.d files now:"
sudo ls /etc/udev/rules.d/
